package com.situ.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.situ.mvc.entity.Student;

// /SpringMVC1907/student/insert.action
// /SpringMVC1907/student/deleteById.action
@Controller
@RequestMapping(value = "/student")
public class StudentController {
	
	@RequestMapping(value = "/insert")
	public ModelAndView insert(Student student) {
		System.out.println("StudentController.insert()");
		System.out.println(student);
		// request.setAttribute("student", student);
		ModelAndView modelAndView = new ModelAndView();
		// 将数据放到域对象中，就是放到request这个域对象
		modelAndView.addObject("student", student);
		// request.getRequestDispather("/student_info.jsp").forward(req,resp);
		modelAndView.setViewName("/student_info.jsp");
		return modelAndView;
	}
	
	@RequestMapping("/deleteById")
	public void deleteById() {
		System.out.println("StudentController.deleteById()");
	}

}
